using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Advanced_Terrain
{
    class TextObject
    {
        public string TextLabel;
        public float TextValue;
        public Vector2 Position;
        public Boolean Visible = true;
        public SpriteFont font;
        public Color TextColor = Color.BlanchedAlmond;
        public SpriteBatch spriteBatch;
        public Boolean Center = false;
        
        public void Update()
        {
            
            if (Visible)
            {
                spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
                Vector2 FontSize = font.MeasureString(TextLabel);
                if (Center)
                {
                    Position.X = (Game1.graphics.GraphicsDevice.Viewport.Width / 2) - (FontSize.X / 2);
                    Position.Y = (Game1.graphics.GraphicsDevice.Viewport.Height / 2) - (FontSize.Y / 2);
                }
                spriteBatch.DrawString(font, TextLabel,  Position, TextColor);
                if (TextValue != 0)
                {
                    Vector2 Position2 = Position;
                    Position2.X += FontSize.X;
                    spriteBatch.DrawString(font, Convert.ToString(TextValue), Position2, TextColor);
                }
                    spriteBatch.End();
                
            }
        }

    }


}
